package com.sunny.springboot2.controller;

import com.sunny.springboot2.core.annotation.CacheLock;
import com.sunny.springboot2.core.annotation.CacheLockParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * redis分布式锁测试controller
 * @author sunny
 * @date 2018/11/29
 */
@RestController
@RequestMapping("/noPer/cacheLock")
public class CacheLockController {

    @CacheLock(prefix = "redis-lock")
    @GetMapping("lock")
    public String query(@CacheLockParam(name = "token") @RequestParam String token) {
        return "success - " + token;
    }
}
